<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      xmlns:th="http://www.thymeleaf.org"
      layout:decorator="backstage/layout">
<head>
    <title>球队管理</title>
</head>

<body>
<div id="content" layout:fragment="content">
<script type="text/javascript" src="../../admin/js/bootstrap-paginator.js"></script>
<script type="text/javascript" src="../../admin/ace/js/fuelux/fuelux.spinner.min.js"></script>
<script type="text/javascript" src="../../admin/ace/js/ace-elements.min.js"></script>
<script type="text/javascript" src="../../../admin/js/teamList.js"></script>
    <div class="box-content">
        <div class="row-fluid sortable">
            <div class="box span12">
                <h3 class="row-fluid header smaller lighter blue">
                   <span class="label label-large label-pink arrowed-right">球队管理</span>
                </h3>   
                <h3 class="row-fluid header smaller lighter blue" th:if="${role !=2}">
                    <a href="#" class="btn btn-small btn-success btn-setting" data-toggle="modal" data-target="#myModal"><i class="icon-user"></i>添加球队</a>
                </h3>
                
                 <form action="/team/teamList.htm" method="post" id="searchForm">
			            <input type="hidden"  id="page" name="page" th:value="${page.page}" />
		            <input type="hidden"  name="totalPage" th:value="${page.totalPage}" />
		            <input type="hidden" id="name" th:value="${page.filter[name]}" />
		            
		            <span class="topword" th:if="${role !=2}">球队名称：</span>
		                <input type="text" class="input-xlarge focused" name="name" th:value="${page.filter[name]}" th:if="${role !=2}"/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            <span class="topword" th:if="${role !=2}">所属学校：</span>
		            			<select name="schoolId"  th:if="${role !=2}">
		            			    <option value=" ">请选择</option>
		            			    <option th:each="school:${schoolList}" th:selected="${school.id == team.schoolId}"  th:value="${school.id}" th:text="${school.name}"></option>
		            			    
		            			</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            <input type="submit" class="btn btn-info btn-inverse" value="搜索" th:if="${role !=2}"/>				
		            
			           
                 </form>
                <div class="box-content">
                    <table class="table table-striped table-bordered bootstrap-datatable datatable">
                        <thead>
                        <tr >
                            <th style="text-align: center;">序号</th>
                            <th style="text-align: center;">球队名称</th>
                            <th style="text-align: center;">所属学校</th>
                            <th style="text-align: center;">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="team:${page.result}">
                            <td th:text="${team.id}" style="text-align: center;"></td>
                            <td th:text="${team.name}" style="text-align: center;"></td>
                            <td th:text="${team.schoolName}" style="text-align: center;"></td>
                            <td style="text-align: center;">
                                <a class="btn btn-small btn-danger" th:id="${team.id}" style="width: 26px;" th:if="${role !=2}">
                                                                                                             删除 
                                </a>
                                 <a class="btn btn-info btn-small editTeamBT" th:id="${team.id}" style="width: 26px;">
                                                                                                           编辑 
                                </a>
                              <input type="hidden" th:id="'teamName-'+${team.id}" th:value="${team.name}"/>
                              <input type="hidden" th:id="'introduction-'+${team.id}" th:value="${team.introduction}"/>
                              <input type="hidden" th:id="'logUrl-'+${team.id}" th:value="${team.logUrl}"/>
                              <input type="hidden" th:id="'schoolId-'+${team.id}" th:value="${team.schoolId}"/>
                              <input type="hidden" th:id="'invitationCode-'+${team.id}" th:value="${team.invitationCode}"/>
                                
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    
                     <div style="margin-bottom: 0px; margin-left: auto;margin-right: auto">
                        <div id="example" style="margin-bottom:0px"></div>
                     </div>
                </div>
            </div><!--/span-->
        </div><!--/row-->
    </div>
    <div id="myModal" class="modal hide fade in" style="width:700px">
        <div class="modal-header">
            <button class="close" data-dismiss="modal" type="button">×</button>
            <h3>添加球队</h3>
        </div>
        <form class="form-horizontal" style="margin: 0" enctype="multipart/form-data" action="/team/addOrUpdateTeam.json" method="post" id="addTeam">
            <fieldset>
                <div class="modal-body">
                    <div class="control-group">
                        <label class="control-label">名称：</label>
                        <div class="controls">
                            <input class="input-xlarge focused" maxlength="5"  type="text" value="" name="name" />
                        </div>
                    </div>
                    
                     <div class="control-group">
                      <label class="control-label">所属学校：</label>
                      <div class="controls">
                          <select  id="schoolId" name="schoolId" >
                              
                              <option th:each="school:${schoolList}"  th:value="${school.id}" th:text="${school.name}"></option>
                          </select>
                      </div>
                </div>
                
                <div class="control-group">
                        <label class="control-label">球队简介：</label>
                        <div class="controls">
                           <textarea   name="introduction"></textarea>
                        </div>
                </div>
                
                <div class="control-group">
                        <label class="control-label">球队宽图LOG：</label>
                        <div class="controls">
                            <div class="widget-main" style="padding:0px;">
	                        	<input type="file" id="id-input-file-1" name="file" />
		                    </div>
                        </div>
                        
                </div>
                
                <div class="control-group">
                        <label class="control-label">球队窄图LOG：</label>
                        <div class="controls">
                            <div class="widget-main" style="padding:0px;">
	                        	<input type="file" id="id-input-file-3" name="file" />
		                    </div>
                        </div>
                        
                </div>
                
                <div class="control-group">
                        <label class="control-label">球队邀请码：</label>
                        <div class="controls">
                            <input class="input-xlarge focused"  type="text" value="" readonly="readonly" name="invitationCode" id="invitationCode"/>
                            <a class="btn btn-info" style="width: 80px;height:20px;margin-left: 10px" onclick="getCode()">获取邀请码 </a>
                        </div>
                </div>
                </div>
                
               
                <div class="modal-footer">
                    <input type="submit" class="btn btn-primary" value="保存" />
                    <a href="#" class="btn btn-small" data-dismiss="modal">取消</a>
                </div>
            </fieldset>
        </form>
    </div>
    
    
    <div id="editModel" class="modal hide fade in" style="display: none;">
        <div class="modal-header">
            <button class="close" data-dismiss="modal" type="button">×</button>
            <h3>编辑球队</h3>
        </div>
        <form class="form-horizontal" style="margin: 0" enctype="multipart/form-data" action="/team/addOrUpdateTeam.json" method="post" id="updateTeam">
             <input id="edit-id" name="id" type="hidden"/>
            <fieldset>
                <div class="modal-body">
                    <div class="control-group">
                        <label class="control-label">名称：</label>
                        <div class="controls">
                            <input class="input-xlarge focused" maxlength="5" type="text" value="" name="name" id="teamName"/>
                        </div>
                    </div>
                    
                    <div class="control-group">
                      <label class="control-label">所属学校：</label>
                      <div class="controls">
                          <select  id="edit-schoolId" name="schoolId" >
                              
                              <option th:each="school:${schoolList}"  th:value="${school.id}" th:text="${school.name}"></option>
                          </select>
                      </div>
                    </div>
                   
                   <div class="control-group">
                        <label class="control-label">球队简介：</label>
                        <div class="controls">
                           <textarea  id="edit-introduction"  style="width:50%; height:70px;" name="introduction"></textarea>
                        </div>
                   </div>
                
                   <div class="control-group">
                        <label class="control-label">球队窄图LOG：</label>
                        <div class="controls">
                            <div class="widget-main">
	                        	<input type="file" id="id-input-file-2" name="file" />
		                    </div>
                        </div>
                        <div class="controls">
                            <div class="widget-main">
                                <img src="" id="edit_imgShow" style="height: 120px"/>
                            </div>
                        </div>
                        
                   </div>
                   
                   <div class="control-group">
                        <label class="control-label">球队窄图LOG：</label>
                        <div class="controls">
                            <div class="widget-main">
	                        	<input type="file" id="id-input-file-4" name="file" />
		                    </div>
                        </div>
                       
                   </div>
                   
                   <div class="control-group">
                        <label class="control-label">球队邀请码：</label>
                        <div class="controls">
                            <input class="input-xlarge focused"  id="edit-invitationCode" type="text" readonly="readonly" value="" name="invitationCode" />
                        </div>
                	</div>
                </div>
                <div class="modal-footer">
                    <input type="submit" class="btn btn-primary" value="保存" />
                    <a href="#" class="btn btn-small" data-dismiss="modal">取消</a>
                </div>
            </fieldset>
        </form>
    </div>
</div>
</body>
</html>
